<?php

class TymPresenter extends BasePresenter
{

	public function renderDefault()
	{
	}
	public function renderInfo($id)
	{
		$tym = new TymModel();
		$lide = new LideModel();
		$pozice = new PoziceModel();
		$this->template->tym = $tym->findById($id)->fetch();
		$id = $this->getParam('id');
		$hraci = $tym->tym_lide_findByTymId($id)->fetchAll();
		foreach($hraci as $item){
			$jmeno = $lide->findById($item['lide_id'])->fetch();
			$item['jmeno'] = $jmeno['jmeno'].' '.$jmeno['prijmeni'];
			$tmp_pozice = $pozice->findById($item['pozice_id'])->fetch();
			
			$item['pozice'] = $tmp_pozice['nazev'];
		}
		$this->template->hraci = $hraci;
		
	}

	
}
